home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / CPP / LINKLIST.ZIP / VOIDCODE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-02  |  1.3 KB  |  54 lines

  1. ///////////////////////////////////////////////////////
  2. //                                                   //
  3. //     Void List Class Functions - Version 1.00      //
  4. //                                                   //
  5. //           By Kevin Campbell 22/7/95               //
  6. //                                                   //
  7. //                                                   //
  8. ///////////////////////////////////////////////////////
  9.  
  10. /*
  11.     This is a piece of example code on how to use the voidlist
  12.     library. THis code has been tested with Borland's Turbo C++
  13.     3.0 and should work on most C++ compilers.
  14. */
  15.  
  16. /*
  17.     To use this library, include the voidlist files into your project
  18. */
  19.  
  20.  
  21. #include "voidlist.h"
  22. #include <string.h>
  23. #include <stdlib.h>
  24. #include <conio.h>
  25. #include <alloc.h>
  26. #include <stdio.h>
  27.  
  28. #define LINK_SIZE 20
  29.  
  30. char name[][20]={"JOHN","MARK"};
  31.  
  32. main(){
  33.   char far *temp;
  34.   void_list names;
  35.   names.add();
  36.   names="JOHN";
  37.   names.add();
  38.   names="MARK";
  39.   names.last();
  40.   temp=(char far *)names.get();
  41.   printf("%s\n",temp);
  42.   names.next();
  43.   temp=(char far *)names.get();
  44.   printf("%s\n",temp);
  45.   //printf("%s\n",names.addr()); // Addr returns a pointer to the data
  46.   getch();
  47.  
  48.   names.nuke(); // flushes all
  49.  
  50.   names.add("BOBBY");
  51.   temp=(char far *)names.get();
  52.   printf("%s\n",temp);
  53.   getch();
  54. }